package com.leetcode;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * @author Dennis Li
 * @date 2020/9/7 22:35
 */
public class ReverseSentence {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);

        Deque<String> stack = new LinkedList<>();

        while (scanner.hasNext()) {
            stack.push(scanner.next());
        }

        while (!stack.isEmpty()) {
            System.out.print(stack.pop() + " ");
        }

    }

}
